# load packages

pacman::p_load(tidyverse, scales)

### figure A.5 (outdoor pools opening and closing months) ----

# load data
opening_times <- read_rds("data/pool_opening_times.rds")

# create plot
ggplot(opening_times, aes(x=months, y=counts*100, fill=variable)) +
    geom_bar(stat="identity", position="dodge") +
    theme_bw() +
    labs(title=element_blank(), x="Month", y="Share") +
    scale_fill_manual(values=c("Opening"="#333333", "Closing"="#999999")) +
    theme(axis.text.x = element_text(angle=0, hjust=1),
          legend.title = element_blank(), legend.position = "bottom") +
    scale_y_continuous(labels = percent_format(scale = 1), lim = c(0,100)) +
    theme(
        axis.title.y = element_text(size = 16),
        axis.title.x = element_text(size = 16),
        title = element_blank(),
        panel.grid.minor = element_blank(),
        panel.grid.major = element_blank(),
        panel.border = element_rect(color = "black", fill = NA, linewidth = 1),
        axis.ticks = element_line(color = "black"),
        axis.ticks.length = unit(0.2, "cm"),
        panel.background = element_rect(fill = "white", colour = "white")) +
    theme(text = element_text(size = 16))

# clean
rm(list = ls())